package com.ruoyi.app.controller;

import com.ruoyi.cms.domain.MemberOrder;
import com.ruoyi.cms.service.IMemberOrderService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author hct
 * @date 2022-10-05
 */
@RestController
@RequestMapping("/app/order")
public class AppMemberOrderController extends BaseController
{
    @Autowired
    private IMemberOrderService memberOrderService;

    @GetMapping("/list")
    public TableDataInfo list(MemberOrder memberOrder)
    {
        startPage();
        List<MemberOrder> list = memberOrderService.selectMemberOrderList(memberOrder);
        return getDataTable(list);
    }


    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(memberOrderService.selectMemberOrderById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping("add")
    public AjaxResult add(MemberOrder memberOrder)
    {
        return toAjax(memberOrderService.insertMemberOrder(memberOrder));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PostMapping("delete/{id}")
    public AjaxResult delete(@PathVariable Long ids)
    {
        return toAjax(memberOrderService.deleteMemberOrderById(ids));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PostMapping("batchDelete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(memberOrderService.deleteMemberOrderByIds(ids));
    }
}
